package com.hongtu.supplychain.finance.interceptor;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 拦截所有响应数据
 *
 * @author chaiy
 * @create 2017-04-11 15:22
 */
public class ResponseInterceptor extends HandlerInterceptorAdapter {
    @Override
    public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
        httpServletResponse.setHeader("Access-Control-Allow-origin", "*");
        httpServletResponse.setHeader("Access-Control-Allow-headers", "appReferrer, lSESSIONID, mobileTicket");
        httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET, POST");
        return true;
    }
}
